package org.hyl.javaext.sf;

public class node {
	public int data;
	public node leftn;
	public node rightn;
	public node parent;
	public node(int data) {
		this.data = data;
	}

	public void addLeft(node n) {
		this.leftn = n;
		n.parent=this;

	}

	public void addRight(node n) {
		this.rightn = n;
		n.parent=this;
	}

	public String iterator() {
		String strl = null;
		String strr = null;
		String s = String.valueOf(data);
		if (leftn != null)
			strl = ' '+leftn.iterator() ;
		if (rightn != null)
			strr = ' '+rightn.iterator() ;
		if (strl != null)
			s += strl ;
		if (strr != null)
			s += strr;
		return s;

	}

}
